﻿namespace GreenIsomer.Web.Controls.JQuery {
	using System;
	using System.ComponentModel;
	using System.Globalization;

	/// <summary>
	/// Provides conversions for the GreenIsomer.Web.Controls.JQuery.MonthNameCollection.
	/// </summary>
	public class MonthNameCollectionConverter : ExpandableObjectConverter {


		#region Static Properties: Override sort order

		private readonly string[] propertyNames = { "Culture", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" };

		#endregion


		#region Methods: Filter

		/// <summary>
		/// Gets a collection of properties for the type of object specified by the value parameter.
		/// </summary>
		/// <param name="context">A System.ComponentModule.ITypeDescriptorContext that provides a format context.</param>
		/// <param name="value">A System.Object that specifies the type of object to get the properties for.</param>
		/// <param name="attributes">An array of type System.Attribute that will be used as a filter.</param>
		/// <returns>A collection of properties.</returns>
		public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes) {
			PropertyDescriptorCollection properties = base.GetProperties(context, value, attributes);
			return properties.Sort(propertyNames);
		}

		#endregion


	}

}